package com.sunshine.feign;

import com.sunshine.feign.bean.Person;
import com.sunshine.feign.server.IPersonClient;
import feign.Feign;
import feign.gson.GsonEncoder;

/**
 * @author WeiHong
 * @date 2018/11/19
 */
public class EncoderTest {

    public static void main(String[] args) {
        //获取服务接口
        IPersonClient personClient = Feign.builder().encoder(new GsonEncoder())
                .target(IPersonClient.class, "http://localhost:8081");
        Person person = new Person(1, "WeiHong", 20);
        person.setMessage("你好");
        String s = personClient.createPerson(person);
        System.out.println("s = " + s);
    }
}
